package com.gopay.remote.cps.approval;

import com.gopay.common.constants.approval.ApprovalID;
import com.gopay.common.constants.approval.DecRequest;
import com.gopay.common.constants.approval.DecUserType;
import com.gopay.common.constants.approval.TargetValue;
import com.gopay.common.domain.approval.Approval;
import com.gopay.common.exception.ApprovalException;

/**
 * 审批决议远程接口
 * 
 * @DecisionRemoteService.java
 * @author yaobo
 * @2013-1-8 上午10:35:31 www.gopay.com.cn Inc.All rights reserved.
 */
public interface DecisionRemoteService {

    /**
     * 获取审批流程明细(如果有多个审批流程时可能会出现对应不一致情况)
     * 
     * <pre>
     * 推荐使用:getApproval(TargetValue targetValue, int approvalId, String targetId);
     * </pre>
     * 
     * @param target
     *            任务目标
     * @param targetId
     *            任务目标编号
     * @return
     * @deprecated
     */
    public Approval getApproval(TargetValue targetValue, String targetId);

    /**
     * 获取审批流程明细
     * 
     * @param target
     *            任务目标
     * @param apprId
     *            审批流程编号
     * @param targetId
     *            任务目标编号
     * @return
     */
    public Approval getApproval(TargetValue targetValue, ApprovalID apprId, String targetId);

    /**
     * 流程审批
     * 
     * @param req
     *            流程审批参数
     * @return
     * @throws ApprovalException
     */
    public boolean decision(DecRequest req) throws ApprovalException;

    /**
     * 审批流程回滚到上一节点
     * 
     * @param taskId
     * @return
     */
    public boolean roolback(int taskId) throws ApprovalException;

    /**
     * 查看用户是否有审批权限
     * 
     * @param targetValue
     *            任务目标
     * @param targetId
     *            任务目标编号
     * @param userId
     *            用户ID
     * @param userType
     *            用户类型
     * @return
     */
    public boolean isDecision(TargetValue targetValue, String targetId, String userId, DecUserType userType);
}
